package com.hsc.yalebao.tabMine;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;

import com.google.gson.Gson;
import com.hsc.yalebao.base.ActivityStack;
import com.hsc.yalebao.base.BaseFragment;
import com.hsc.yalebao.base.CustomApplication;
import com.hsc.yalebao.base.MainActivity;
import com.hsc.yalebao.http.AppConstants;
import com.hsc.yalebao.http.RequestNet;
import com.hsc.yalebao.model.BaseDataObject;
import com.hsc.yalebao.model.GetUserGroupTypeModel;
import com.hsc.yalebao.model.UserBaseBean;
import com.hsc.yalebao.tools.NoDoubleClickUtils;
import com.hsc.yalebao.tools.UiUtil;
import com.hsc.yalebao.weight.LogUtils;
import com.hsc.yalebao.weight.MyDialog1;
import com.hsc.yalebao.weight.RoundImageView;
import com.hsc.yalebao.zhuanpan.ZhuanPanActivity;
import com.zhy.http.okhttp.callback.StringCallback;

import java.io.PrintStream;
import java.util.HashMap;

import okhttp3.Call;

@SuppressLint({"NewApi"})
public class MineFragment extends BaseFragment
        implements View.OnClickListener {
    public static MineFragment fragment;
    private String TAG = "MineFragment";
    private View contentView;
    private int group_Id;
    private String guid = "";
    int imgRight = 8;
    private ImageView img_edit_data;
    public RoundImageView img_photo;
    private LinearLayout lin_personal_info;
    private LinearLayout lin_user_data;
    private LinearLayout ll_about;
    private LinearLayout ll_bq;
    private LinearLayout ll_daili_houtai;
    private LinearLayout ll_daili_kaihu;
    private LinearLayout ll_fx;
    private LinearLayout ll_huishui;
    private LinearLayout ll_jl;
    private LinearLayout ll_luckcz;
    private LinearLayout ll_myget;
    private LinearLayout ll_qb;
    private LinearLayout ll_set;
    private LinearLayout ll_tongji;
    private LinearLayout ll_vip_fx;
    private LinearLayout ll_wf;
    private LinearLayout ll_zb;
    private int memberId;
    private MyDialog1 myDialog1;
    private TextView text_ge_xian;
    private TextView text_user_name;
    public TextView txt_money_left;

    private void closeWindowSoftInput() {
        InputMethodManager localInputMethodManager = (InputMethodManager) getActivity().getSystemService("input_method");
        boolean bool = localInputMethodManager.isActive();
        LogUtils.d("-MianWebActivity-", "isSoftActive：" + bool);
        if (bool) {
            localInputMethodManager.hideSoftInputFromWindow(this.contentView.getApplicationWindowToken(), 0);
            LogUtils.d(this.TAG, "强制隐藏键盘");
        }
    }

    public void getUserAmount() {
        this.txt_money_left.setText("获取中...");
        HashMap localHashMap = new HashMap();
        localHashMap.put("guid", this.guid);
        LogUtils.d(this.TAG, "URL:" + AppConstants.URL_GET_USER_AMOUNT);
        RequestNet.get(getActivity(), AppConstants.URL_GET_USER_AMOUNT, localHashMap, new StringCallback() {
            public void onError(Call paramAnonymousCall, Exception paramAnonymousException) {
                LogUtils.e(MineFragment.this.TAG, "获取失败,getUserAmount-result:" + paramAnonymousException);
            }

            public void onResponse(String paramAnonymousString) {
                LogUtils.d(MineFragment.this.TAG, "result:" + paramAnonymousString);
                Gson localGson = new Gson();
                String str;
                try {
                    localBaseDataObject = (BaseDataObject) localGson.fromJson(paramAnonymousString, BaseDataObject.class);
                    if (localBaseDataObject == null)
                        return;
                } catch (Exception localException) {
                    BaseDataObject localBaseDataObject;
                    do {
                        FragmentActivity localFragmentActivity1;
                        do {
                            FragmentActivity localFragmentActivity2;
                            do {
                                while (true) {
                                    localException.printStackTrace();
                                    localBaseDataObject = null;
                                }
                                if (localBaseDataObject.getFlag() == 0) {
                                    UiUtil.showToast(MineFragment.this.getActivity(), localBaseDataObject.getMsg());
                                    return;
                                }
                                if (localBaseDataObject.getFlag() != -2)
                                    break;
                                localFragmentActivity2 = MineFragment.this.getActivity();
                            }
                            while (!(localFragmentActivity2 instanceof MainActivity));
                            ((MainActivity) localFragmentActivity2).showOffLineDialog();
                            return;
                            if (localBaseDataObject.getFlag() != -3)
                                break;
                            localFragmentActivity1 = MineFragment.this.getActivity();
                        }
                        while (!(localFragmentActivity1 instanceof MainActivity));
                        ((MainActivity) localFragmentActivity1).showFengjinDialog();
                        return;
                        if (localBaseDataObject.getFlag() == -4) {
                            ActivityStack.getInstance().backToMain(MainActivity.class, MineFragment.this.getActivity());
                            return;
                        }
                    }
                    while (localBaseDataObject.getFlag() != 1);
                    str = localBaseDataObject.getResult();
                    if (str == null) ;
                }
                try {
                    CustomApplication.app.userAmount = Double.parseDouble(str);
                    LogUtils.d("获取成功", "getUserAmount()-result:" + str);
                    MineFragment.this.txt_money_left.setText(str + "元宝");
                    return;
                } catch (NumberFormatException localNumberFormatException) {
                    while (true)
                        localNumberFormatException.printStackTrace();
                }
            }
        });
    }

    public void getUserGroupType() {
        HashMap localHashMap = new HashMap();
        localHashMap.put("guid", this.guid);
        LogUtils.d(this.TAG, "URL:" + AppConstants.URL_GET_USER_GETUSERGROUPTYPE);
        MainActivity.mainActivity.showLoadingDialog();
        RequestNet.get(getActivity(), AppConstants.URL_GET_USER_GETUSERGROUPTYPE, localHashMap, new StringCallback() {
            public void onError(Call paramAnonymousCall, Exception paramAnonymousException) {
                MainActivity.mainActivity.dismissLoadingDialog();
                MineFragment.this.ll_fx.setVisibility(0);
                MineFragment.this.ll_vip_fx.setVisibility(8);
                MineFragment.this.ll_myget.setVisibility(8);
                MineFragment.this.ll_daili_houtai.setVisibility(8);
                MineFragment.this.ll_daili_kaihu.setVisibility(8);
                LogUtils.e(MineFragment.this.TAG, "获取失败,getUserGroupType-result:" + paramAnonymousException);
            }

            public void onResponse(String paramAnonymousString) {
                MainActivity.mainActivity.dismissLoadingDialog();
                LogUtils.d(MineFragment.this.TAG, "result:" + paramAnonymousString);
                Gson localGson = new Gson();
                try {
                    localGetUserGroupTypeModel = (GetUserGroupTypeModel) localGson.fromJson(paramAnonymousString, GetUserGroupTypeModel.class);
                    if (localGetUserGroupTypeModel == null)
                        return;
                } catch (Exception localException) {
                    GetUserGroupTypeModel localGetUserGroupTypeModel;
                    do {
                        FragmentActivity localFragmentActivity1;
                        do {
                            FragmentActivity localFragmentActivity2;
                            do {
                                while (true) {
                                    localException.printStackTrace();
                                    localGetUserGroupTypeModel = null;
                                }
                                if (localGetUserGroupTypeModel.getFlag() == 0) {
                                    UiUtil.showToast(MineFragment.this.getActivity(), localGetUserGroupTypeModel.getMsg());
                                    return;
                                }
                                if (localGetUserGroupTypeModel.getFlag() != -2)
                                    break;
                                localFragmentActivity2 = MineFragment.this.getActivity();
                            }
                            while (!(localFragmentActivity2 instanceof MainActivity));
                            ((MainActivity) localFragmentActivity2).showOffLineDialog();
                            return;
                            if (localGetUserGroupTypeModel.getFlag() != -3)
                                break;
                            localFragmentActivity1 = MineFragment.this.getActivity();
                        }
                        while (!(localFragmentActivity1 instanceof MainActivity));
                        ((MainActivity) localFragmentActivity1).showFengjinDialog();
                        return;
                        if (localGetUserGroupTypeModel.getFlag() == -4) {
                            ActivityStack.getInstance().backToMain(MainActivity.class, MineFragment.this.getActivity());
                            return;
                        }
                    }
                    while (localGetUserGroupTypeModel.getFlag() != 1);
                    int i = localGetUserGroupTypeModel.getGrouptype();
                    LogUtils.e(MineFragment.this.TAG, "getUserGroupType()-grouptype:" + i);
                    if ((i == 0) || (1 == i)) {
                        MineFragment.this.ll_fx.setVisibility(0);
                        MineFragment.this.ll_vip_fx.setVisibility(8);
                        MineFragment.this.ll_myget.setVisibility(8);
                        MineFragment.this.ll_daili_houtai.setVisibility(8);
                        MineFragment.this.ll_daili_kaihu.setVisibility(8);
                        return;
                    }
                    if (2 == i) {
                        MineFragment.this.ll_myget.setVisibility(0);
                        MineFragment.this.ll_vip_fx.setVisibility(0);
                        MineFragment.this.ll_fx.setVisibility(8);
                        MineFragment.this.ll_daili_houtai.setVisibility(8);
                        MineFragment.this.ll_daili_kaihu.setVisibility(8);
                        return;
                    }
                    if (3 == i) {
                        MineFragment.this.ll_vip_fx.setVisibility(8);
                        MineFragment.this.ll_myget.setVisibility(8);
                        MineFragment.this.ll_fx.setVisibility(0);
                        MineFragment.this.ll_daili_houtai.setVisibility(0);
                        MineFragment.this.ll_daili_kaihu.setVisibility(0);
                        return;
                    }
                    if (i >= 4) {
                        MineFragment.this.ll_myget.setVisibility(0);
                        MineFragment.this.ll_vip_fx.setVisibility(0);
                        MineFragment.this.ll_fx.setVisibility(8);
                        MineFragment.this.ll_daili_houtai.setVisibility(8);
                        MineFragment.this.ll_daili_kaihu.setVisibility(8);
                        return;
                    }
                    MineFragment.this.ll_fx.setVisibility(0);
                    MineFragment.this.ll_vip_fx.setVisibility(8);
                    MineFragment.this.ll_myget.setVisibility(8);
                    MineFragment.this.ll_daili_houtai.setVisibility(8);
                    MineFragment.this.ll_daili_kaihu.setVisibility(8);
                }
            }
        });
    }

    public void init() {
        this.lin_personal_info = ((LinearLayout) this.contentView.findViewById(2131100068));
        this.img_photo = ((RoundImageView) this.contentView.findViewById(2131100043));
        this.img_photo.setOnClickListener(this);
        this.text_user_name = ((TextView) this.contentView.findViewById(2131100071));
        this.text_ge_xian = ((TextView) this.contentView.findViewById(2131100113));
        this.txt_money_left = ((TextView) this.contentView.findViewById(2131099926));
        LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(-1, CustomApplication.app.getScreenSize().heightPixels / 4);
        this.lin_personal_info.setLayoutParams(localLayoutParams);
        this.lin_user_data = ((LinearLayout) this.contentView.findViewById(2131100069));
        this.img_edit_data = ((ImageView) this.contentView.findViewById(2131100114));
        this.ll_tongji = ((LinearLayout) this.contentView.findViewById(2131100118));
        this.ll_tongji.setVisibility(8);
        this.ll_set = ((LinearLayout) this.contentView.findViewById(2131100128));
        this.ll_qb = ((LinearLayout) this.contentView.findViewById(2131100115));
        this.ll_wf = ((LinearLayout) this.contentView.findViewById(2131100122));
        this.ll_about = ((LinearLayout) this.contentView.findViewById(2131100129));
        this.ll_wf.setVisibility(8);
        this.ll_bq = ((LinearLayout) this.contentView.findViewById(2131100127));
        this.ll_huishui = ((LinearLayout) this.contentView.findViewById(2131100116));
        this.ll_jl = ((LinearLayout) this.contentView.findViewById(2131100120));
        this.ll_myget = ((LinearLayout) this.contentView.findViewById(2131100124));
        this.ll_zb = ((LinearLayout) this.contentView.findViewById(2131100119));
        this.ll_fx = ((LinearLayout) this.contentView.findViewById(2131100121));
        this.ll_vip_fx = ((LinearLayout) this.contentView.findViewById(2131100123));
        this.ll_daili_kaihu = ((LinearLayout) this.contentView.findViewById(2131100125));
        this.ll_daili_houtai = ((LinearLayout) this.contentView.findViewById(2131100126));
        this.lin_personal_info.setOnClickListener(this);
        this.ll_daili_houtai.setOnClickListener(this);
        this.lin_user_data.setOnClickListener(this);
        this.img_edit_data.setOnClickListener(this);
        this.ll_tongji.setOnClickListener(this);
        this.ll_set.setOnClickListener(this);
        this.ll_qb.setOnClickListener(this);
        this.ll_wf.setOnClickListener(this);
        this.ll_bq.setOnClickListener(this);
        this.ll_huishui.setOnClickListener(this);
        this.ll_jl.setOnClickListener(this);
        this.ll_about.setOnClickListener(this);
        this.ll_zb.setOnClickListener(this);
        this.ll_fx.setOnClickListener(this);
        this.ll_myget.setOnClickListener(this);
        this.ll_daili_kaihu.setOnClickListener(this);
        this.ll_vip_fx.setOnClickListener(this);
        this.ll_luckcz = ((LinearLayout) this.contentView.findViewById(2131100117));
        this.ll_luckcz.setOnClickListener(this);
        if ((MainActivity.mainActivity.getmEnable() != null) && (MainActivity.mainActivity.getmEnable().equals("1"))) {
            this.ll_luckcz.setVisibility(0);
            return;
        }
        this.ll_luckcz.setVisibility(8);
    }

    public void initUserDatas() {
        String str1;
        if (CustomApplication.app.userBaseBean != null) {
            str1 = CustomApplication.app.userBaseBean.getNick_name();
            String str2 = CustomApplication.app.userBaseBean.getSignature();
            if ((str1 != null) && (!"".equals(str1)))
                break label194;
            this.text_user_name.setText("点击设置昵称");
            if ((str2 == null) || ("".equals(str2)))
                break label205;
            this.text_ge_xian.setText(str2);
            label73:
            String str3 = CustomApplication.app.userBaseBean.getUser_logo();
            if ((str3 == null) || ("".equals(str3)))
                break label218;
            UiUtil.loadRoundImage(AppConstants.BASE_URL_IMG + str3, getActivity(), this.img_photo);
        }
        while (true) {
            this.memberId = CustomApplication.app.userBaseBean.getMemberid();
            this.guid = CustomApplication.app.userBaseBean.getGuid();
            this.group_Id = CustomApplication.app.userBaseBean.getGroup_Id();
            LogUtils.e(this.TAG, "group_Id:" + this.group_Id);
            return;
            label194:
            this.text_user_name.setText(str1);
            break;
            label205:
            this.text_ge_xian.setText("这个人很懒，没有签名");
            break label73;
            label218:
            this.img_photo.setImageResource(2130838020);
        }
    }

    public void isShowZhuanPan() {
        if (this.ll_luckcz != null) {
            if ((MainActivity.mainActivity.getmEnable() != null) && (MainActivity.mainActivity.getmEnable().equals("1")))
                this.ll_luckcz.setVisibility(0);
        } else
            return;
        this.ll_luckcz.setVisibility(8);
    }

    public void onActivityCreated(Bundle paramBundle) {
        super.onActivityCreated(paramBundle);
    }

    public void onClick(View paramView) {
        switch (paramView.getId()) {
            default:
            case 2131100043:
            case 2131100069:
            case 2131100114:
                do {
                    return;
                    MainActivity.mainActivity.showPickPhotoPopupWindow();
                    return;
                }
                while (NoDoubleClickUtils.isDoubleClick());
                startActivity(new Intent(getActivity(), EditDataActivity.class));
                return;
            case 2131100118:
                startActivity(new Intent(getActivity(), TongJiActivity.class));
                return;
            case 2131100128:
                startActivity(new Intent(getActivity(), SetActivity.class));
                return;
            case 2131100115:
                startActivity(new Intent(getActivity(), QianBaoActivity.class));
                return;
            case 2131100122:
                Intent localIntent = new Intent(getActivity(), WanFaActivity.class);
                localIntent.putExtra("instructionType", "0");
                startActivity(localIntent);
                return;
            case 2131100127:
                this.myDialog1.setMessage("此功能暂未开放");
                this.myDialog1.show();
                this.myDialog1.btn_confirm.setOnClickListener(new View.OnClickListener() {
                    public void onClick(View paramAnonymousView) {
                        MineFragment.this.myDialog1.dismiss();
                    }
                });
                return;
            case 2131100116:
                startActivity(new Intent(getActivity(), HuiShuiActivity.class));
                return;
            case 2131100120:
                startActivity(new Intent(getActivity(), JiLuActivity.class));
                return;
            case 2131100129:
                startActivity(new Intent(getActivity(), AboutActivity.class));
                return;
            case 2131100119:
                startActivity(new Intent(getActivity(), AccountChangeActivity.class));
                return;
            case 2131100121:
                startActivity(new Intent(getActivity(), ShareActivity.class));
                return;
            case 2131100123:
                startActivity(new Intent(getActivity(), VipshareActivity.class));
                return;
            case 2131100126:
                startActivity(new Intent(getActivity(), DaiLiHoutaiActivity.class));
                return;
            case 2131100124:
                startActivity(new Intent(getActivity(), MygetActivity.class));
                return;
            case 2131100125:
                startActivity(new Intent(getActivity(), DaiLiActivity.class));
                return;
            case 2131100117:
        }
        startActivity(new Intent(getActivity(), ZhuanPanActivity.class));
    }

    public void onCreate(Bundle paramBundle) {
        super.onCreate(paramBundle);
        fragment = this;
        this.myDialog1 = new MyDialog1(getActivity());
    }

    public View onCreateView(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle) {
        this.contentView = paramLayoutInflater.inflate(2130903129, null);
        init();
        setTitle(8, 8, 0, "我的", 0, 8, 8, 0, true);
        return this.contentView;
    }

    public void onDestroy() {
        super.onDestroy();
        closeWindowSoftInput();
    }

    public void onResume() {
        super.onResume();
        System.out.println(this.TAG + "onResume");
        initUserDatas();
        if (CustomApplication.app.isLogin) {
            getUserAmount();
            getUserGroupType();
        }
    }

    @SuppressLint({"NewApi"})
    public void setTitle(int paramInt1, int paramInt2, int paramInt3, String paramString, int paramInt4, int paramInt5, int paramInt6, int paramInt7, boolean paramBoolean) {
        View localView = this.contentView.findViewById(2131099716);
        if (paramBoolean)
            localView.setVisibility(0);
        while (true) {
            ((TextView) localView.findViewById(2131099701)).setText(paramString);
            ((TextView) localView.findViewById(2131099700)).setVisibility(paramInt1);
            ImageView localImageView1 = (ImageView) localView.findViewById(2131099699);
            localImageView1.setVisibility(paramInt2);
            localImageView1.setImageResource(paramInt3);
            ((TextView) localView.findViewById(2131099702)).setVisibility(paramInt5);
            ImageView localImageView2 = (ImageView) localView.findViewById(2131099704);
            localImageView2.setVisibility(paramInt6);
            localImageView2.setImageResource(paramInt7);
            return;
            localView.setVisibility(8);
        }
    }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.hsc.yalebao.tabMine.MineFragment
 * JD-Core Version:    0.6.2
 */